package homeWork.title5;
/*
   （第5题）有一个字符串"woaijavahahajavaaiwo" 删除该字符串中所有的"java"并且统计删除了多少个“java”
    */
public class main {
    public static void main(String[] args) {
        String str = "woaijavahahajavaaiwo";
        int end = str.indexOf("java");
        int start = 0;
        while (end!=-1){
            str = str.substring(0,end)+str.substring(end+4);
            end = str.indexOf("java");
            start++;
        }
        System.out.println(str);
        System.out.println("总共出现了"+start+"次java");
    }
}
